name := "edge-channel-data-packet-decoder-flink"

version := "0.1"

ThisBuild / resolvers ++= Seq(
  "Apache Development Snapshot Repository" at "https://repository.apache.org/content/repositories/snapshots/",
  Resolver.mavenLocal
)

organization := "com.eshipenet.shipnet"

ThisBuild / scalaVersion := "2.12.8"

//conflictManager := ConflictManager.latestRevision

val flinkVersion = "1.9.0"

// https://mvnrepository.com/artifact/com.typesafe.play/play-json
//libraryDependencies += "com.typesafe.play" %% "play-json" % "2.6.9"
//libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "2.20.0"
// https://mvnrepository.com/artifact/com.github.etaty/rediscala
//libraryDependencies += "com.github.etaty" %% "rediscala" % "1.8.0"

val flinkDependencies = Seq(
  "org.apache.flink" %% "flink-scala" % flinkVersion % "provided",
  "org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "provided",
  // https://mvnrepository.com/artifact/org.apache
  // .flink/flink-connector-kafka-0.11
  "org.apache.flink" %% "flink-connector-kafka" % flinkVersion,
  // https://mvnrepository.com/artifact/org.apache.flink/flink-avro
  "org.apache.flink" % "flink-avro" % flinkVersion,
  // https://mvnrepository.com/artifact/org.apache.flink/flink-avro
  "org.apache.flink" % "flink-avro-confluent-registry" % flinkVersion
)

//libraryDependencies += "com.softwaremill.odelay" %% "odelay-core" % "0.3.0"

//libraryDependencies += "com.eshipenet.shipnet" %% "expr" % "0.2"

libraryDependencies += "org.json4s" %% "json4s-native" % "3.6.7"

// https://mvnrepository.com/artifact/org.apache.kafka/kafka
//libraryDependencies += "org.apache.kafka" %% "kafka" % "2.2.0"
// https://mvnrepository.com/artifact/org.apache.kafka/connect-api
//libraryDependencies += "org.apache.kafka" % "connect-api" % "2.2.0"


//libraryDependencies += "com.datamountaineer" % "kafka-connect-common" % "1.1.8"
// https://mvnrepository.com/artifact/com.sksamuel.avro4s/avro4s-core
libraryDependencies += "com.sksamuel.avro4s" %% "avro4s-core" % "3.0.1"

lazy val root = (project in file(".")).
  settings(
    libraryDependencies ++= flinkDependencies
  )

assembly / mainClass := Some("com.eshipenet.shipnet.dp_decoder.Main")

// make run command include the provided dependencies
Compile / run  := Defaults.runTask(Compile / fullClasspath,
  Compile / run / mainClass,
  Compile / run / runner
).evaluated

// stays inside the sbt console when we press "ctrl-c" while a Flink programme executes with "run" or "runMain"
Compile / run / fork := true
Global / cancelable := true

// exclude Scala library from assembly
assembly / assemblyOption  := (assembly / assemblyOption).value.copy(includeScala = false)

//assemblyMergeStrategy in assembly := {
//  case "META-INF\\io.netty.versions.properties" =>
//    MergeStrategy.first
//  case x =>
//    val oldStrategy = (assemblyMergeStrategy in assembly).value
//    oldStrategy(x)
//}
//sourceGenerators in Compile += (avroScalaGenerateSpecific in Compile).taskValue
